import printJS from 'print-js'

export const printTable = (dataList: Array<any>, properties: Array<any>, title: string) => {
  let header = ''
  if (title) {
    header = `
    <div style="display: flex;flex-direction: column;text-align: center">
       <h3>${title}</h3>
    </div>`
  }
  // 打印方法
  printJS({
    printable: dataList,
    header: header,
    properties: properties,
    type: 'json',
    gridHeaderStyle: 'border: 1px solid #000;text-align:left;padding-left: 2px;word-break: break-all;',
    gridStyle: 'border: 1px solid #000;text-align:left;padding-left: 2px;word-break: break-all;'
  })
}
